export const imgerror = {
  // 当被绑定的元素插入到 DOM 中时……
  inserted: function(el, binding) {
    // el 为dom元素
    // binding.value 为传入的值 v-imgerror = "img";  binding.value = img
    el.src = el.src || binding.value
    // onerror 是图片地址加载错误时候触发
    // onload 是图片地址加载成功时候触发
    el.onerror = () => {
      el.src = binding.value
    }
  },
  componentUpdated(el, binding) {
    el.src = el.src || binding.value
  }
}
